﻿<navigation:PageView x:Class="Corina.Cydee.Apphub.Views.Devices.SpecimenKindView"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:controls="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
                     xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                     xmlns:localViewmodel="clr-namespace:Corina.Cydee.Apphub.Viewmodels"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:navigation="clr-namespace:Corina.Cydee.Apphub.Base"
                     xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                     d:DesignHeight="480"
                     d:DesignWidth="960"
                     mc:Ignorable="d">
    <navigation:PageView.DataContext>
        <localViewmodel:SpecimenKindViewmodel />
    </navigation:PageView.DataContext>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
            <controls:TextBoxExt Width="200"
                                 PlaceText="添加或修改种类名称"
                                 Text="{Binding Title,
                                                Mode=TwoWay,
                                                UpdateSourceTrigger=PropertyChanged}" />
            <Button MinWidth="60"
                    Margin="12,0"
                    Command="{Binding SubmitCommand}"
                    Content="提交" />

            <Button MinWidth="60"
                    Command="{Binding CancelCommand}"
                    Content="取消" />
        </StackPanel>

        <toolkit:BusyIndicator Grid.Row="1"
                               Margin="0,12"
                               BusyContent="{StaticResource IDS_BUSYCONTENT_LOADING}"
                               IsBusy="{Binding IsBusy}">
            <ListBox ItemsSource="{Binding ItemsCollection}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <toolkit:WrapPanel>
                            <i:Interaction.Behaviors>
                                <ei:FluidMoveBehavior />
                            </i:Interaction.Behaviors>
                        </toolkit:WrapPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Background" Value="{StaticResource RatingStarsBrush}" />
                        <Setter Property="BorderBrush" Value="{StaticResource RatingStarsBrush}" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <Grid Margin="6">

                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="Normal" />
                                                <VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="border" Storyboard.TargetProperty="(Border.BorderThickness)">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>1</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimation Duration="0"
                                                                         Storyboard.TargetName="border1"
                                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                         To="1"
                                                                         d:IsOptimized="True" />
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled" />
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>

                                        <Border x:Name="border"
                                                Background="White"
                                                BorderBrush="{TemplateBinding BorderBrush}"
                                                BorderThickness="0" />
                                        <StackPanel>
                                            <Grid>
                                                <Border x:Name="border1"
                                                        Background="{TemplateBinding Background}"
                                                        CornerRadius="2"
                                                        Opacity="0" />
                                                <ContentControl x:Name="contentControl"
                                                                Content="{Binding Title}"
                                                                FontFamily="{TemplateBinding FontFamily}"
                                                                FontSize="16"
                                                                Padding="6" />
                                            </Grid>
                                            <StackPanel x:Name="stackPanel"
                                                        Orientation="Horizontal"
                                                        Visibility="Collapsed">
                                                <HyperlinkButton Margin="6,3"
                                                                 Command="{Binding Path=DataContext.UpdateCommand,
                                                                                   RelativeSource={RelativeSource AncestorType=navigation:PageView}}"
                                                                 CommandParameter="{Binding }"
                                                                 Content="修改" />
                                                <HyperlinkButton Margin="6,3"
                                                                 Command="{Binding Path=DataContext.RemoveCommand,
                                                                                   RelativeSource={RelativeSource AncestorType=navigation:PageView}}"
                                                                 CommandParameter="{Binding Id}"
                                                                 Content="删除" />
                                            </StackPanel>
                                        </StackPanel>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>
        </toolkit:BusyIndicator>
    </Grid>
</navigation:PageView>
